<div ng-controller="bpmProcessStartController">
    <div class="bg-light lter b-b wrapper-md">
        <div><h1 class="m-n font-thin h3">
            启动流程—<span ng-if="map.hasStartFormKey">[{{map.processDefinition.name}}]，版本号：{{map.processDefinition.version}}</span>
            <span ng-if="!map.hasStartFormKey">[{{map.startFormData.processDefinition.name}}]，版本号：{{map.startFormData.processDefinition.version}}</span>
        </h1></div>
    </div>
    <div>
        <ng-form role="form" name="form" class="form-validation">
            <div class="panel panel-default">
                <div class="panel-heading">
                </div>

                <div class="panel-body">
                    <div class="col-sm-12" ng-if="!map.hasStartFormKey">
                        <div class="form-group col-sm-6 no-padder" ng-repeat="fp in map.startFormData.formProperties">
                            <label class="col-sm-3 control-label">{{fp.name}}</label>
                            <div class="col-sm-9" ng-if="fp.type.name == 'string'">
                                <input type="text" class="form-control m-b-xs" name="{{fp.id}}" ng-disabled="!fp.writable"
                                       placeholder="{{fp.name}}" ng-model="formData[fp.id]" ng-required="fp.required">
                            </div>
                            <div class="col-sm-9" ng-if="fp.type.name == 'double' || fp.type.name == 'long'">
                                <input type="number" class="form-control m-b-xs" name="{{fp.id}}"  ng-disabled="!fp.writable"
                                       placeholder="{{fp.name}}" ng-model="formData[fp.id]" ng-required="fp.required">
                            </div>
                            <div class="col-sm-9" ng-if="fp.type.name == 'bigtext'">
                                <textarea  name="{{fp.id}}"  placeholder="{{fp.name}}" class="form-control m-b-xs" ng-model="formData[fp.id]" ng-required="fp.required" ng-disabled="!fp.writable"></textarea>
                            </div>
                            <div class="col-sm-9" ng-if="fp.type.name == 'date'">
                                <div class="input-group" d-datepicker ng-model="formData[fp.id]" d-datepicker-option="{format : '{{map.formPropertiesInformation[fp.id].datePattern  | uppercase}}'}">
                                    <input type="text" class="form-control m-b-xs" name="{{fp.id}}" ng-disabled="!fp.writable"
                                           placeholder="{{fp.name}}" ng-model="formData[fp.id]" ng-required="fp.required">
                                <span class="input-group-btn">
                                    <button type="button" class="btn btn-default m-b-xs" ng-click="open($event)" ng-disabled="!fp.writable"><i class="glyphicon glyphicon-calendar"></i></button>
                                </span>
                                </div>
                            </div>
                            <div class="col-sm-9" ng-if="fp.type.name == 'enum'">
                                <select class="form-control m-b-xs" name="{{fp.id}}" placeholder="{{fp.name}}" ng-model="formData[fp.id]" ng-required="fp.required"
                                        ng-options="key as value for (key,value) in map.formPropertiesInformation[fp.id].values" ng-disabled="!fp.writable">
                                </select>
                            </div>
                            <div class="col-sm-9 m-b-xs" ng-if="fp.type.name == 'users'" >
                                <select ui-jq="chosen" multiple data-placeholder="请选择人员名单" class="form-control m-b-xs" name="{{fp.id}}" placeholder="{{fp.name}}" ng-model="formData[fp.id]" required="fp.required" ng-required="fp.required"
                                        ng-options="row.name as row.name for row in userList" ng-disabled="!fp.writable">
                                </select>
                            </div>
                            <div class="col-sm-9" ng-if="fp.type.name == 'javascript'">
                                <script type="text/javascript"></script>
                            </div>
                            <div ng-if="fp.type.name != 'javascript'" class="line line-dashed b-b line-lg pull-in  no-paging no-border"></div>
                        </div>
                    </div>
                </div>
            </div>
            <footer class="panel-footer  lter">
                <!-- alert -->
                <div class="m-b-md">
                    <uib-alert ng-repeat="alert in Alert.alerts" type="{{alert.type}}" close="Alert.closeAlert($index)">
                        {{alert.msg}}
                    </uib-alert>
                </div>
                <!-- / alert -->
                <button type="submit" class="btn btn-success" ng-disabled="form.$invalid || saveBtnDisable" ng-click="startUp(); saveBtnDisable = true;">启动流程
                </button>
                <button type="submit" class="btn btn-success" ng-click="canle()">返回</button>
            </footer>
        </ng-form>
    </div>
</div>